import {
  exportUrl,
  getLineCodeList,
  getProductProcessCodeList,
  getWorkCellCodeList,
  getWorkTeamCodeList,
  getSimulatedTypeList,
} from "@/api/record/mesScanRecordDetail";
// 列表头按钮配置
export const operateList = [
  // {
  //   name: "导出",
  //   type: "primary",
  //   icon: "el-icon-download",
  //   handleName: "export", //点击时返回的标识
  //   url: exportUrl,
  //   //auth: "auth:operlog:export", //权限字段
  // },
  {
    name: $i18n.t("afterReportWorkPrint.printButton"),
    type: "primary",
    icon: "el-icon-printer",
    handleName: "print", //点击时返回的标识
    disabled: (data) => {
      // let orderStatus = data[0]?.orderStatus ?? "";
      // return data.length != 1 || orderStatus >= 2;
      return data.length == 0;
    },
  },
  // {
  //   name: $i18n.t("common.delete"),
  //   type: "danger",
  //   icon: "el-icon-delete",
  //   handleName: "deleteBatch", //点击时返回的标识
  // },
];
// 行末按钮配置
export const rowConfig = [
  {
    name: $i18n.t("common.edit"),
    type: "primary",
    class: "row-btn-primary",
    handleName: "edit", //点击时返回的标识
  },
  {
    name: $i18n.t("common.details"),
    type: "info",
    class: "row-btn-info",
    handleName: "detail", //点击时返回的标识
  },
  {
    name: $i18n.t("common.delete"),
    type: "danger",
    class: "row-btn-danger",
    handleName: "delete", //点击时返回的标识
  },
];
// 搜索条件配置
export const searchConfig = {
  data() {
    const _this = this;
    return {
      searchDialog: {
        inline: true,
        formDesc: {
          barcode: {
            type: "input",
            label: $i18n.t("afterReportWorkPrint.serialNumber"),
          },
          lineCode: {
            label: $i18n.t("afterReportWorkPrint.productLine"),
            type: "select",
            prop: {
              value: "modelingCode",
              text: "modelingName",
            },
            options: async (data) => {
              const params = {
                modelingCode: _this.$store.getters.factoryCode,
                level: 5,
              };
              const list = await getLineCodeList(params);
              return list.data.result;
            },
          },
          // lineName: {
          //   type: "input",
          //   label: "生产线体名称",
          // },
          productProcessCode: {
            type: "select",
            label: $i18n.t("afterReportWorkPrint.productProcess"),
            prop: {
              value: "processCode",
              text: "processName",
            },
            options: async (data) => {
              const list = await getProductProcessCodeList();
              return list.data.result;
            },
            // on: {
            //   change: (val) => {
            //     that.handleSelectLine(val)
            //   }
            // }
          },
          // productProcessName: {
          //   type: "input",
          //   label: "生产工序名称",
          // },
          // workCellCode: {
          //   type: "select",
          //   label: $i18n.t("mesScanRecordDetail.collectionStation"),
          //   prop: {
          //     value: "value",
          //     text: "description",
          //   },
          //   options: async (data) => {
          //     const list = await getWorkCellCodeList();
          //     return list.data.result;
          //   },
          // },
          // workCellName: {
          //   type: "input",
          //   label: "采集工位名称",
          // },
          // workTeamCode: {
          //   type: "select",
          //   label: "采集班组编码",
          //   type: 'select',
          //   prop: {
          //     value: "value",
          //     text: "description",
          //   },
          //   options: async (data) => {
          //     const list = await getWorkTeamCodeList()
          //     return list.data.result
          //   },
          // },
          // workTeamName: {
          //   type: "input",
          //   label: "采集班组名称",
          // },
          scanTime: {
            type: "datetimerange",
            label: $i18n.t("afterReportWorkPrint.scanTime"),
            attrs: {
              valueFormat: "yyyy-MM-dd HH:mm:ss",
              searchArrKey: ["scanTimeMin", "scanTimeMax"],
            },
          },
          orderCode: {
            type: "input",
            label: $i18n.t("afterReportWorkPrint.orderCode"),
          },
          // prodCode: {
          //   type: "input",
          //   label: "产品编码",
          // },
          prodName: {
            type: "input",
            label: $i18n.t("afterReportWorkPrint.prodName"),
          },
          // seriesCode: {
          //   type: "input",
          //   label: "系列编码",
          // },
          // seriesName: {
          //   type: "input",
          //   label: "系列名称",
          // },
          // simulatedType: {
          //   type: "select",
          //   label: "虚实订单类型",
          //   type: 'select',
          //   prop: {
          //     value: "value",
          //     text: "description",
          //   },
          //   options: async (data) => {
          //     const list = await getSimulatedTypeList()
          //     return list.data.result
          //   },
          // },
          // prodOrderType: {
          //   type: "select",
          //   label: "生产订单类型",
          //   type: 'select',
          //   prop: {
          //     value: "value",
          //     text: "description",
          //   },
          //   options: async (data) => {
          //     const list = await getProdOrderTypeList()
          //     return list.data.result
          //   },
          // },
        },
      },
    };
  },
};
